qutebrowser CommandRunner

In the qutebrowser, commands are parsed and executed using the CommandRunner class. This class is a subclass of the AbstractCommandRunner class. The key method is run(), which is used to execute command strings.

The CommandRunner has two important class attributes:

The run Method

The method signature is:

def run(self, text, count=None, *, safely=False):

Here, text is the original string of the command entered by the user.

The parsing and execution process is as follows:

def run(self, text, count=None, *, safely=False):
	#……

	# parse user command
    parsed = None
    with self._handle_error(safely):
        parsed = self._parser.parse_all(text)

    if parsed is None:
        return

    for result in parsed:
        with self._handle_error(safely):
            #……

			# run command
            result.cmd.run(self._win_id, args, count=count)

        if result.cmdline[0] in ['repeat-command', 'cmd-repeat-last']:
            record_last_command = False

	#……

本文作者:Maeiee

本文链接:qutebrowser CommandRunner

版权声明:如无特别声明,本文即为原创文章,版权归 Maeiee 所有,未经允许不得转载!


喜欢我文章的朋友请随缘打赏,鼓励我创作更多更好的作品!